﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.JSInterop.Infrastructure;
using PoemGame.Domain.Services.Feihualing;
using PoemGameWebApiService.Shared;
using PoemService.Shared;

namespace PoemGameFeihualingWebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class FeihualingController : ControllerBase
    {
        private readonly IPoemService poemService;
        private readonly FeihualingCheckAnswerService feihualingCheckAnswerService;
        private readonly  FeihualingCheckGameConditionService feihualingCheckGameConditionService;

        public FeihualingController(IPoemService poemService, 
            FeihualingCheckAnswerService feihualingCheckAnswerService, 
            FeihualingCheckGameConditionService feihualingCheckGameConditionService)
        {
            this.poemService = poemService;
            this.feihualingCheckAnswerService = feihualingCheckAnswerService;
            this.feihualingCheckGameConditionService = feihualingCheckGameConditionService;
        }

        [HttpPost("CheckAnswer")]
        public async Task<bool> CheckAnswer(CheckAnswerServiceDto dto)
        {
            return await feihualingCheckAnswerService.CheckAnswer(dto.Input,dto.Answer);
        }

        [HttpPost("CheckCondition")]
        public async Task<bool> CheckCondition(CheckConditionServiceDto dto)
        {
            return await feihualingCheckGameConditionService.CheckGameCondition(dto.Condition);
        }
    }
}
